//
//  ChooseDiseaseTypeView.m
//  KYProject
//
//  Created by Roman on 16/12/22.
//  Copyright © 2016年 Roman. All rights reserved.
//

#import "ChooseDiseaseTypeView.h"
#import "NetWorkTool.h"
#import "DoctorApplyModel.h"
#import "ProgressManager.h"

@interface ChooseDiseaseTypeView ()
@property (nonatomic, strong) DoctorApplyModel *model;
@end

@implementation ChooseDiseaseTypeView


+ (instancetype)chooseDiseaseView{
    return [[UINib nibWithNibName:NSStringFromClass(self) bundle:nil] instantiateWithOwner:nil options:nil].lastObject;
}


//已确诊按钮
- (IBAction)clickDiagnosisBtn:(UIButton *)sender {
    sender.selected = YES;
    self.btn_SuspectedSymptoms.selected = NO;
    self.lb_Diagnosis.text = @"已确诊";
    self.lb_Diagnosis.textColor = [UIColor blackColor];
    
}

//症状疑似
- (IBAction)clickSuspectedSyBtn:(UIButton *)sender{
    sender.selected = YES;
    self.btn_Diagnosis.selected = NO;
    self.lb_Diagnosis.text = @"症状疑似";
    self.lb_Diagnosis.textColor = [UIColor blackColor];
}

//接受过确诊
- (IBAction)clickReceivedBtn:(UIButton *)sender {
    sender.selected = YES;
    self.btn_NotReceived.selected = NO;
    self.iv_TreatmentModality.hidden = NO;
    self.lb_Treatment.text = @"接受过";
    self.lb_Treatment.textColor = [UIColor blackColor];
}

//未接受过确诊
- (IBAction)clickNotReceivedBtn:(UIButton *)sender{
    sender.selected = YES;
    self.btn_Received.selected = NO;
    self.iv_TreatmentModality.hidden = YES;
    self.lb_Treatment.text = @"未接受过";
    self.lb_Treatment.textColor = [UIColor blackColor];
}


//选择疾病细分  lb_DiseaseDetail;
//选择并发症  lb_DiseaseOnSet;
//治疗方式   lb_TreatmentModality;
- (void)awakeFromNib
{
    [super awakeFromNib];
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickLable:)];
    
    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickLable:)];
    
    UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickLable:)];
    /*
     UIImageView 默认的userInteractionEnabled是NO；
     UILabel默认 userInteractionEnabled是NO；
     UIView的userInteractionEnabled默认是YES。
     */
    self.lb_DiseaseDetail.userInteractionEnabled = YES;
    self.lb_DiseaseOnSet.userInteractionEnabled = YES;
    self.lb_TreatmentModality.userInteractionEnabled = YES;
    //选择疾病细分
    [self.lb_DiseaseDetail addGestureRecognizer:tap];
    //选择并发症
    [self.lb_DiseaseOnSet addGestureRecognizer:tap1];
    //治疗方式
    [self.lb_TreatmentModality addGestureRecognizer:tap2];
}
/*
     疾病细分
     @property (nonatomic, copy) Block DiseaseDetailBlock;
     选择并发症
     @property (nonatomic, copy) Block DiseaseOnSetBlock;
     治疗方式
     @property (nonatomic, copy) Block TreatmentModalityBlock;
 */
- (void)clickLable:(UITapGestureRecognizer *)sender
{
    NSLog(@".......");
    if (sender.view == self.lb_DiseaseDetail)
    {
        if (_DiseaseDetailBlock)
        {
            _DiseaseDetailBlock();
        }
        NSLog(@"选择疾病细分");
    }else if (sender.view == self.lb_DiseaseOnSet)
    {
        if (_DiseaseOnSetBlock) {
            _DiseaseOnSetBlock();
        }
        NSLog(@"选择并发症");
        
    }else if (sender.view == self.lb_TreatmentModality)
    {
        if (_TreatmentModalityBlock) {
            _TreatmentModalityBlock();  
        }
        NSLog(@"治疗方式");
        
    }
    
}
#pragma mark
#pragma mark - 判断btn状态是否是normal
- (BOOL)isBtnNormal
{
    return YES;
}
//就医申请
- (IBAction)clicktreatmentApplicationBtn:(UIButton *)sender {
    
    
    [ProgressManager alertSuccessStatus:@"申请成功"];
    //通知,点击然后实现跳转到名医通申请
    [[NSNotificationCenter defaultCenter] postNotificationName:@"ApplicationBtn" object:nil ];
    
    
  // [self.navigationController popViewControllerAnimated:YES];
}



////访问网络得到所有医生信息
//-(void)accessWebForAllDoctorInfo{
//    NSString *urlString = @"http://iosapi.itcast.cn/matchDoctors.json.php";
//    NSDictionary *paramDic = @{@"ci1_id":@1,
//                               @"ci2_id":@3,
//                               @"ci3_id":@3,
//                               @"diagnosis_type":@0,
//                               @"page_size":@15,
//                               @"is_confirmed":@1,
//                               @"user_id":@1000089,
//                               @"page":@1,
//                               @"has_diagnosis":@2
//                               };
//    
//    __weak ChooseDiseaseTypeView *weakSelf = self;
//    [[NetWorkTool shareManager] POST_RequestWithUrlString:urlString parmas:paramDic successBloock:^(id responseObject) {
//        NSLog(@"%@",responseObject);
//        NSDictionary *tempDict = responseObject;
//        if([tempDict[@"msg"] isEqualToString:@"OK"]){
//            NSArray *dataArr = tempDict[@"data"];
//            NSInteger index = arc4random_uniform(15);
//            NSDictionary *firstItem = dataArr[index];
//            
//            weakSelf.model = [[DoctorApplyModel alloc]init];
//            [weakSelf.model yy_modelSetWithJSON:firstItem];
//            
//            [ProgressManager alertSuccessStatus:@"申请成功"];
//            
//        }
//    } failureBlock:^(NSError *error) {
//        
//    }];
//    
//    
//    
//}








@end
